package com.ruoyi.points.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.points.mapper.CommunityUserPointsMapper;
import com.ruoyi.points.domain.CommunityUserPoints;
import com.ruoyi.points.service.ICommunityUserPointsService;

/**
 * 用户积分账户Service业务层处理
 * 
 * @author xianyu
 * @date 2025-04-03
 */
@Service
public class CommunityUserPointsServiceImpl implements ICommunityUserPointsService 
{
    @Autowired
    private CommunityUserPointsMapper communityUserPointsMapper;

    /**
     * 查询用户积分账户
     * 
     * @param id 用户积分账户主键
     * @return 用户积分账户
     */
    @Override
    public CommunityUserPoints selectCommunityUserPointsById(Long id)
    {
        return communityUserPointsMapper.selectCommunityUserPointsById(id);
    }

    @Override
    public int updateUserPointsWithVersion(CommunityUserPoints userPoints) {
        return communityUserPointsMapper.updateUserPointsWithVersion(userPoints);
    }
    /**
     * 查询用户积分账户列表
     * 
     * @param communityUserPoints 用户积分账户
     * @return 用户积分账户
     */
    @Override
    public List<CommunityUserPoints> selectCommunityUserPointsList(CommunityUserPoints communityUserPoints)
    {
        return communityUserPointsMapper.selectCommunityUserPointsList(communityUserPoints);
    }

    @Override
    public CommunityUserPoints selectByUserId(Long userId) {
        return communityUserPointsMapper.selectByUserId(userId);
    }

    /**
     * 新增用户积分账户
     * 
     * @param communityUserPoints 用户积分账户
     * @return 结果
     */
    @Override
    public int insertCommunityUserPoints(CommunityUserPoints communityUserPoints)
    {
        return communityUserPointsMapper.insertCommunityUserPoints(communityUserPoints);
    }

    /**
     * 修改用户积分账户
     * 
     * @param communityUserPoints 用户积分账户
     * @return 结果
     */
    @Override
    public int updateCommunityUserPoints(CommunityUserPoints communityUserPoints)
    {
        communityUserPoints.setUpdateTime(DateUtils.getNowDate());
        return communityUserPointsMapper.updateCommunityUserPoints(communityUserPoints);
    }

    /**
     * 批量删除用户积分账户
     * 
     * @param ids 需要删除的用户积分账户主键
     * @return 结果
     */
    @Override
    public int deleteCommunityUserPointsByIds(Long[] ids)
    {
        return communityUserPointsMapper.deleteCommunityUserPointsByIds(ids);
    }

    /**
     * 删除用户积分账户信息
     * 
     * @param id 用户积分账户主键
     * @return 结果
     */
    @Override
    public int deleteCommunityUserPointsById(Long id)
    {
        return communityUserPointsMapper.deleteCommunityUserPointsById(id);
    }
}
